//
//  NavigationBarView.swift
//  GreenDeal
//
//  Created by Moennig Q on 2023/4/20.
//

import UIKit
import SnapKit
class NavigationBarView: View {

    let backToPreBtn = UIButton()
    let titleLabel = ContentLabel(R.font.interBold(size: 18),hexStr: "#FFFFFFFF")
    
    override func setUpView() {
        let topMargin: CGFloat = UIDevice.getStatusBarHeight() + 10
        let btnHeight: CGFloat = 40
        let btnLeftMargin: CGFloat = 8
        //
        //titleLabel
        titleLabel.numberOfLines = 0
        titleLabel.textAlignment = .center
        self.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { make in
            make.top.equalTo(topMargin)
            make.left.equalTo(btnHeight + btnLeftMargin)
            make.right.equalTo(-(btnHeight + btnLeftMargin))
            make.height.equalTo(btnHeight)
            make.bottom.equalTo(-10)
        }
        backToPreBtn.setImage(R.image.navigation_bar_back_white_icon(), for: UIControl.State.normal)
        self.addSubview(backToPreBtn)
        backToPreBtn.snp.makeConstraints { make in
            make.left.equalTo(btnLeftMargin)
            make.width.height.equalTo(btnHeight)
            make.centerY.equalTo(titleLabel)
        }
    }
    func setTitle(_ title: String){
        self.titleLabel.text = title
    }
}
